﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class NewsType_NewsTypeSelect : System.Web.UI.UserControl
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }

    public void BindData(int newsId)
    {
        CMSModel.CMSEntities dal = DAL.DBManager.GetCmsEmtity();
        cbxlstCid.DataSource= dal.NewsType.Where(x => x.pid == Pid);
        cbxlstCid.DataValueField = "id";
        cbxlstCid.DataTextField = "name";
        cbxlstCid.DataBind();
        var pType= dal.NewsType.Where(x => x.id == Pid).First();
        lblPType.Text = pType.name;
    }

    public string Pid
    {
        get
        {
            return  ViewState["pid"].ToString();
        }
        set
        {
            ViewState["pid"] = value;
        }
    }
}